#!/usr/bin/env python2.7
# ----------------------------------------------------------------------------
# This manually transmits an entire message instead of going through the
# usual ihave/iwant cycle. Intended for getting a new post out immediately.

import sys
import site_config as cfg
import qrpbbb_lib as lib

#

if len(sys.argv) != 2:
    print "Need a filename."
    exit(1)

message = lib.fetch_messagetext(sys.argv[1])
msgid = lib.message_hash(message)
print "\nFilename:", sys.argv[1], "\nmsgid:   ", msgid

msgidsdb = lib.msgids_scan()

if msgidsdb.get(msgid) == None:
    print "Refusing to inject a Bozo's unscrubbed message."
    exit(1)

print

# perhaps do an A:nnounce as well..

ls = lib.create_linespec (range(1, len(message.splitlines())+1))
lib.qrpbbb_request (msgidsdb, msgid, ls)

#
# ----------------------------------------------------------------------------
#
